package com.gitee.blogcase.gracepaycase.service.impl;

import com.gitee.blogcase.gracepaycase.annocation.Pay;
import com.gitee.blogcase.gracepaycase.dto.PayDTO;
import com.gitee.blogcase.gracepaycase.service.PayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 支付宝impl
 *
 * @author wentao.wu
 * @date 2022/01/06
 */
@Component
@Slf4j
@Pay(mode = "ALIPAY")
public class AlipayImpl implements PayService {
    @Override
    public <T> void befor(PayDTO<T> payDTO) {
        log.info("支付宝支付前，准备参数等....");
    }

    @Override
    public <T> boolean invoke(PayDTO<T> payDTO) {
        log.info("调用支付宝支付接口提交支付....");
        return true;
    }

    @Override
    public <T> void errorAfter(PayDTO<T> payDTO) {
        log.info("支付宝支付失败记录日志....");
    }


    @Override
    public <T> void okAfter(PayDTO<T> payDTO) {
        log.info("支付宝支付成功给用户发送消息通知用户支付成功了....");
    }
}